package com.teemor.blog.controller;

import com.teemor.blog.api.IIprecordApiService;
import com.teemor.blog.bean.condition.TbIprecordCondition;
import com.teemor.blog.bean.dto.input.iprecord.AddIprecordIPo;
import com.teemor.blog.bean.dto.input.iprecord.QryIprecordsIPo;
import com.teemor.blog.bean.dto.input.iprecord.UpdIprecordIPo;
import com.teemor.blog.bean.dto.output.BaseInfo;
import com.teemor.blog.bean.dto.output.iprecord.QryIprecordOPo;
import com.teemor.blog.bean.dto.output.iprecord.QryIprecordsOPo;
import com.teemor.blog.bean.entity.TbIprecord;
import com.teemor.blog.service.IIprecordService;
import java.util.List;

import com.teemor.common.bean.utils.BeanConvertor;
import io.swagger.models.auth.In;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author: zhoulk
 * @Description: 原子服务API接口实现
 * @date: 2020/03/19 20:59:38
 */
@RestController
public class IprecordController implements IIprecordApiService {
    @Autowired
    private IIprecordService iIprecordService;

    @Override
    public List<QryIprecordsOPo> qryIprecords( QryIprecordsIPo inParam) {
        TbIprecordCondition condition = BeanConvertor.convertBean(inParam, TbIprecordCondition.class);
        return BeanConvertor.convertBeanList(iIprecordService.qryIprecords(condition), QryIprecordsOPo.class);
    }


    @Override
    public void addIprecord(@RequestBody AddIprecordIPo inParam) {
        TbIprecord tbIprecord = BeanConvertor.convertBean(inParam, TbIprecord.class);
        iIprecordService.addIprecord(tbIprecord);
    }

    @Override
    public BaseInfo qryBaseInfo() {
        return iIprecordService.qryBaseInfo();
    }
}